--- title: Recreating Steffl's Flatfields keywords: fastai sidebar: home_sidebar summary: "Based on his thesis appendix" description: "Based on his thesis appendix" nb_path: "notebooks/06_calib.steffl.ipynb" ---
hv.extension("bokeh", logo=False)
missing = [] there = [] for id in obsids: try: data = UVPDS(id, skip_download=True) except FileNotFoundError: print(id, "not there.") missing.append(id) else: print("Got", id) there.append(id)
cat = CatalogFilter(steffl_spica_dates[2])
pids = list(cat.get_euv_date().query("OBSERVATION_TYPE=='CALIB'").index)
pids
cat.set_next_day()
pids.extend(list(cat.get_euv_date().query("OBSERVATION_TYPE=='CALIB'").index))
pids
kwargs = {"x": "nx", "y": "ny", "cmap": "viridis", "clim": (0, 50)}
pids
r2r = Row2Row(pids[0])
r2r.plot_set
r2r.plot_averaged
r2r.plot_ff
r2r.plot_integrated
r2r.plot_column_std
r2r.ff
c2c = Col2Col(pids)
c2c.calculate_simple_correction()
c2c.plot_all_Fm()
c2c.plot_simple_correction()
c2c.plot_r2r_flats()
c2c.r2r_flat_average_plot()
c2c.simple_both_plot()
c2c.i=100
c2c.m=0
c2c.plot_triplet()
c2c.plot_triplet(corrected=True)
def compare_before_after(i=0):
p1 = (
c2c.arr.where(c2c.arr > 0, np.nan)
.isel(across_slit=i, drop=True)
.hvplot(
x="spectral",
y="spatial",
cmap="viridis",
logz=True,
label="Original",
# widget_type="scrubber",
widget_location="bottom",
)
)
p2 = (
c2c.corrected_arr.where(c2c.corrected_arr > 0, np.nan)
.isel(across_slit=i, drop=True)
.hvplot.image(
x="spectral",
y="spatial",
cmap="viridis",
logz=True,
label="Corrected",
# widget_type="scrubber",
widget_location="bottom",
)
)
return pn.Column(p1) + pn.Column(p2)
slider = pn.widgets.IntSlider(end=14)
pn.interact(compare_before_after, i=(0, 14))
p2 = c2c.corrected_arr.where(c2c.corrected_arr > 0, np.nan).isel(across_slit=i, drop=True).hvplot.image(
x="spectral",
y="spatial",
cmap="viridis",
logz=True,
label="Corrected",
# widget_type="scrubber",
widget_location="bottom",
)
import panel as pn
pn.Column(p1) + pn.Column(p2)
(p1+p2)
c2c.simple_both.isel(spectral=slice(15, 998), spatial=slice(3,61)).mean().data
iarr = c2c.arr.interactive()
from panel import widgets
ival = widgets.IntSlider(start=0, end=1024)
mval = widgets.IntSlider()
iarr.isel(spectral=ival, drop=True).hvplot().layout()
c2c.calculate_simple_correction()
c2c.simple_correction
c2c.i = 200
c2c.m = 0
c2c.column_set_mean() / c2c.column_set()[0]
c2c.column_set()[0]
c2c.i = 200
c2c.m = 3
c2c.plot_averaged_triplet()
c2c.plot_triplet(corrected=False, i=300)
c2c.plot_simple_correction()
c2c.simple_correction.shape
c2c.plot_Fm(0)
c2c.plot_triplet()
c2c.column_set_mean()
c2c.plot()
archive_df.loc["EUV2001_093_08_35_28"]
p = obsdir / "index_repaired.tab"
df = pd.read_csv(p, quotechar='"', skipinitialspace=True)
from planetarypy.pds.indexes import find_mixed_type_cols
find_mixed_type_cols(df, fix=False)
df.columns
index.columns
index[index.filename.str.startswith("EUV")].iloc[0]
obs.head()
cols = ["index start_time stop_time detector target obsid_time unknown type comment "]